home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / cc / gcc.info-19 (.txt) < prev    next >
GNU Info File  |  1993-10-21  |  50KB  |  853 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Scalar Return,  Next: Aggregate Return,  Prev: Register Arguments,  Up: Stack and Calling
  23. How Scalar Function Values Are Returned
  24. ---------------------------------------
  25.    This section discusses the macros that control returning scalars as
  26. values--values that can fit in registers.
  27. `TRADITIONAL_RETURN_FLOAT'
  28.      Define this macro if `-traditional' should not cause functions
  29.      declared to return `float' to convert the value to `double'.
  30. `FUNCTION_VALUE (VALTYPE, FUNC)'
  31.      A C expression to create an RTX representing the place where a
  32.      function returns a value of data type VALTYPE.  VALTYPE is a tree
  33.      node representing a data type.  Write `TYPE_MODE (VALTYPE)' to get
  34.      the machine mode used to represent that type.  On many machines,
  35.      only the mode is relevant.  (Actually, on most machines, scalar
  36.      values are returned in the same place regardless of mode).
  37.      If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same
  38.      promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar
  39.      type.
  40.      If the precise function being called is known, FUNC is a tree node
  41.      (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This
  42.      makes it possible to use a different value-returning convention
  43.      for specific functions when all their calls are known.
  44.      `FUNCTION_VALUE' is not used for return vales with aggregate data
  45.      types, because these are returned in another way.  See
  46.      `STRUCT_VALUE_REGNUM' and related macros, below.
  47. `FUNCTION_OUTGOING_VALUE (VALTYPE, FUNC)'
  48.      Define this macro if the target machine has "register windows" so
  49.      that the register in which a function returns its value is not the
  50.      same as the one in which the caller sees the value.
  51.      For such machines, `FUNCTION_VALUE' computes the register in which
  52.      the caller will see the value.  `FUNCTION_OUTGOING_VALUE' should be
  53.      defined in a similar fashion to tell the function where to put the
  54.      value.
  55.      If `FUNCTION_OUTGOING_VALUE' is not defined, `FUNCTION_VALUE'
  56.      serves both purposes.
  57.      `FUNCTION_OUTGOING_VALUE' is not used for return vales with
  58.      aggregate data types, because these are returned in another way.
  59.      See `STRUCT_VALUE_REGNUM' and related macros, below.
  60. `LIBCALL_VALUE (MODE)'
  61.      A C expression to create an RTX representing the place where a
  62.      library function returns a value of mode MODE.  If the precise
  63.      function being called is known, FUNC is a tree node
  64.      (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This
  65.      makes it possible to use a different value-returning convention
  66.      for specific functions when all their calls are known.
  67.      Note that "library function" in this context means a compiler
  68.      support routine, used to perform arithmetic, whose name is known
  69.      specially by the compiler and was not mentioned in the C code being
  70.      compiled.
  71.      The definition of `LIBRARY_VALUE' need not be concerned aggregate
  72.      data types, because none of the library functions returns such
  73.      types.
  74. `FUNCTION_VALUE_REGNO_P (REGNO)'
  75.      A C expression that is nonzero if REGNO is the number of a hard
  76.      register in which the values of called function may come back.
  77.      A register whose use for returning values is limited to serving as
  78.      the second of a pair (for a value of type `double', say) need not
  79.      be recognized by this macro.  So for most machines, this definition
  80.      suffices:
  81.           #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
  82.      If the machine has register windows, so that the caller and the
  83.      called function use different registers for the return value, this
  84.      macro should recognize only the caller's register numbers.
  85. `APPLY_RESULT_SIZE'
  86.      Define this macro if `untyped_call' and `untyped_return' need more
  87.      space than is implied by `FUNCTION_VALUE_REGNO_P' for saving and
  88.      restoring an arbitrary return value.
  89. File: gcc.info,  Node: Aggregate Return,  Next: Caller Saves,  Prev: Scalar Return,  Up: Stack and Calling
  90. How Large Values Are Returned
  91. -----------------------------
  92.    When a function value's mode is `BLKmode' (and in some other cases),
  93. the value is not returned according to `FUNCTION_VALUE' (*note Scalar
  94. Return::.).  Instead, the caller passes the address of a block of
  95. memory in which the value should be stored.  This address is called the
  96. "structure value address".
  97.    This section describes how to control returning structure values in
  98. memory.
  99. `RETURN_IN_MEMORY (TYPE)'
  100.      A C expression which can inhibit the returning of certain function
  101.      values in registers, based on the type of value.  A nonzero value
  102.      says to return the function value in memory, just as large
  103.      structures are always returned.  Here TYPE will be a C expression
  104.      of type `tree', representing the data type of the value.
  105.      Note that values of mode `BLKmode' must be explicitly handled by
  106.      this macro.  Also, the option `-fpcc-struct-return' takes effect
  107.      regardless of this macro.  On most systems, it is possible to
  108.      leave the macro undefined; this causes a default definition to be
  109.      used, whose value is the constant 1 for `BLKmode' values, and 0
  110.      otherwise.
  111.      Do not use this macro to indicate that structures and unions
  112.      should always be returned in memory.  You should instead use
  113.      `DEFAULT_PCC_STRUCT_RETURN' to indicate this.
  114. `DEFAULT_PCC_STRUCT_RETURN'
  115.      Define this macro to be 1 if all structure and union return values
  116.      must be in memory.  Since this results in slower code, this should
  117.      be defined only if needed for compatibility with other compilers
  118.      or with an ABI.  If you define this macro to be 0, then the
  119.      conventions used for structure and union return values are decided
  120.      by the `RETURN_IN_MEMORY' macro.
  121.      If not defined, this defaults to the value 1.
  122. `STRUCT_VALUE_REGNUM'
  123.      If the structure value address is passed in a register, then
  124.      `STRUCT_VALUE_REGNUM' should be the number of that register.
  125. `STRUCT_VALUE'
  126.      If the structure value address is not passed in a register, define
  127.      `STRUCT_VALUE' as an expression returning an RTX for the place
  128.      where the address is passed.  If it returns 0, the address is
  129.      passed as an "invisible" first argument.
  130. `STRUCT_VALUE_INCOMING_REGNUM'
  131.      On some architectures the place where the structure value address
  132.      is found by the called function is not the same place that the
  133.      caller put it.  This can be due to register windows, or it could
  134.      be because the function prologue moves it to a different place.
  135.      If the incoming location of the structure value address is in a
  136.      register, define this macro as the register number.
  137. `STRUCT_VALUE_INCOMING'
  138.      If the incoming location is not a register, then you should define
  139.      `STRUCT_VALUE_INCOMING' as an expression for an RTX for where the
  140.      called function should find the value.  If it should find the
  141.      value on the stack, define this to create a `mem' which refers to
  142.      the frame pointer.  A definition of 0 means that the address is
  143.      passed as an "invisible" first argument.
  144. `PCC_STATIC_STRUCT_RETURN'
  145.      Define this macro if the usual system convention on the target
  146.      machine for returning structures and unions is for the called
  147.      function to return the address of a static variable containing the
  148.      value.
  149.      Do not define this if the usual system convention is for the
  150.      caller to pass an address to the subroutine.
  151.      This macro has effect in `-fpcc-struct-return' mode, but not in
  152.      `-freg-struct-return' mode.
  153. File: gcc.info,  Node: Caller Saves,  Next: Function Entry,  Prev: Aggregate Return,  Up: Stack and Calling
  154. Caller-Saves Register Allocation
  155. --------------------------------
  156.    If you enable it, GNU CC can save registers around function calls.
  157. This makes it possible to use call-clobbered registers to hold
  158. variables that must live across calls.
  159. `DEFAULT_CALLER_SAVES'
  160.      Define this macro if function calls on the target machine do not
  161.      preserve any registers; in other words, if `CALL_USED_REGISTERS'
  162.      has 1 for all registers.  This macro enables `-fcaller-saves' by
  163.      default.  Eventually that option will be enabled by default on all
  164.      machines and both the option and this macro will be eliminated.
  165. `CALLER_SAVE_PROFITABLE (REFS, CALLS)'
  166.      A C expression to determine whether it is worthwhile to consider
  167.      placing a pseudo-register in a call-clobbered hard register and
  168.      saving and restoring it around each function call.  The expression
  169.      should be 1 when this is worth doing, and 0 otherwise.
  170.      If you don't define this macro, a default is used which is good on
  171.      most machines: `4 * CALLS < REFS'.
  172. File: gcc.info,  Node: Function Entry,  Next: Profiling,  Prev: Caller Saves,  Up: Stack and Calling
  173. Function Entry and Exit
  174. -----------------------
  175.    This section describes the macros that output function entry
  176. ("prologue") and exit ("epilogue") code.
  177. `FUNCTION_PROLOGUE (FILE, SIZE)'
  178.      A C compound statement that outputs the assembler code for entry
  179.      to a function.  The prologue is responsible for setting up the
  180.      stack frame, initializing the frame pointer register, saving
  181.      registers that must be saved, and allocating SIZE additional bytes
  182.      of storage for the local variables.  SIZE is an integer.  FILE is
  183.      a stdio stream to which the assembler code should be output.
  184.      The label for the beginning of the function need not be output by
  185.      this macro.  That has already been done when the macro is run.
  186.      To determine which registers to save, the macro can refer to the
  187.      array `regs_ever_live': element R is nonzero if hard register R is
  188.      used anywhere within the function.  This implies the function
  189.      prologue should save register R, provided it is not one of the
  190.      call-used registers.  (`FUNCTION_EPILOGUE' must likewise use
  191.      `regs_ever_live'.)
  192.      On machines that have "register windows", the function entry code
  193.      does not save on the stack the registers that are in the windows,
  194.      even if they are supposed to be preserved by function calls;
  195.      instead it takes appropriate steps to "push" the register stack,
  196.      if any non-call-used registers are used in the function.
  197.      On machines where functions may or may not have frame-pointers, the
  198.      function entry code must vary accordingly; it must set up the frame
  199.      pointer if one is wanted, and not otherwise.  To determine whether
  200.      a frame pointer is in wanted, the macro can refer to the variable
  201.      `frame_pointer_needed'.  The variable's value will be 1 at run
  202.      time in a function that needs a frame pointer.  *Note
  203.      Elimination::.
  204.      The function entry code is responsible for allocating any stack
  205.      space required for the function.  This stack space consists of the
  206.      regions listed below.  In most cases, these regions are allocated
  207.      in the order listed, with the last listed region closest to the
  208.      top of the stack (the lowest address if `STACK_GROWS_DOWNWARD' is
  209.      defined, and the highest address if it is not defined).  You can
  210.      use a different order for a machine if doing so is more convenient
  211.      or required for compatibility reasons.  Except in cases where
  212.      required by standard or by a debugger, there is no reason why the
  213.      stack layout used by GCC need agree with that used by other
  214.      compilers for a machine.
  215.         * A region of `current_function_pretend_args_size' bytes of
  216.           uninitialized space just underneath the first argument
  217.           arriving on the stack.  (This may not be at the very start of
  218.           the allocated stack region if the calling sequence has pushed
  219.           anything else since pushing the stack arguments.  But
  220.           usually, on such machines, nothing else has been pushed yet,
  221.           because the function prologue itself does all the pushing.)
  222.           This region is used on machines where an argument may be
  223.           passed partly in registers and partly in memory, and, in some
  224.           cases to support the features in `varargs.h' and `stdargs.h'.
  225.         * An area of memory used to save certain registers used by the
  226.           function.  The size of this area, which may also include
  227.           space for such things as the return address and pointers to
  228.           previous stack frames, is machine-specific and usually
  229.           depends on which registers have been used in the function.
  230.           Machines with register windows often do not require a save
  231.           area.
  232.         * A region of at least SIZE bytes, possibly rounded up to an
  233.           allocation boundary, to contain the local variables of the
  234.           function.  On some machines, this region and the save area
  235.           may occur in the opposite order, with the save area closer to
  236.           the top of the stack.
  237.         * Optionally, when `ACCUMULATE_OUTGOING_ARGS' is defined, a
  238.           region of `current_function_outgoing_args_size' bytes to be
  239.           used for outgoing argument lists of the function.  *Note
  240.           Stack Arguments::.
  241.      Normally, it is necessary for the macros `FUNCTION_PROLOGUE' and
  242.      `FUNCTION_EPILOGUE' to treat leaf functions specially.  The C
  243.      variable `leaf_function' is nonzero for such a function.
  244. `EXIT_IGNORE_STACK'
  245.      Define this macro as a C expression that is nonzero if the return
  246.      instruction or the function epilogue ignores the value of the stack
  247.      pointer; in other words, if it is safe to delete an instruction to
  248.      adjust the stack pointer before a return from the function.
  249.      Note that this macro's value is relevant only for functions for
  250.      which frame pointers are maintained.  It is never safe to delete a
  251.      final stack adjustment in a function that has no frame pointer,
  252.      and the compiler knows this regardless of `EXIT_IGNORE_STACK'.
  253. `FUNCTION_EPILOGUE (FILE, SIZE)'
  254.      A C compound statement that outputs the assembler code for exit
  255.      from a function.  The epilogue is responsible for restoring the
  256.      saved registers and stack pointer to their values when the
  257.      function was called, and returning control to the caller.  This
  258.      macro takes the same arguments as the macro `FUNCTION_PROLOGUE',
  259.      and the registers to restore are determined from `regs_ever_live'
  260.      and `CALL_USED_REGISTERS' in the same way.
  261.      On some machines, there is a single instruction that does all the
  262.      work of returning from the function.  On these machines, give that
  263.      instruction the name `return' and do not define the macro
  264.      `FUNCTION_EPILOGUE' at all.
  265.      Do not define a pattern named `return' if you want the
  266.      `FUNCTION_EPILOGUE' to be used.  If you want the target switches
  267.      to control whether return instructions or epilogues are used,
  268.      define a `return' pattern with a validity condition that tests the
  269.      target switches appropriately.  If the `return' pattern's validity
  270.      condition is false, epilogues will be used.
  271.      On machines where functions may or may not have frame-pointers, the
  272.      function exit code must vary accordingly.  Sometimes the code for
  273.      these two cases is completely different.  To determine whether a
  274.      frame pointer is wanted, the macro can refer to the variable
  275.      `frame_pointer_needed'.  The variable's value will be 1 when
  276.      compiling a function that needs a frame pointer.
  277.      Normally, `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE' must treat
  278.      leaf functions specially.  The C variable `leaf_function' is
  279.      nonzero for such a function.  *Note Leaf Functions::.
  280.      On some machines, some functions pop their arguments on exit while
  281.      others leave that for the caller to do.  For example, the 68020
  282.      when given `-mrtd' pops arguments in functions that take a fixed
  283.      number of arguments.
  284.      Your definition of the macro `RETURN_POPS_ARGS' decides which
  285.      functions pop their own arguments.  `FUNCTION_EPILOGUE' needs to
  286.      know what was decided.  The variable that is called
  287.      `current_function_pops_args' is the number of bytes of its
  288.      arguments that a function should pop.  *Note Scalar Return::.
  289. `DELAY_SLOTS_FOR_EPILOGUE'
  290.      Define this macro if the function epilogue contains delay slots to
  291.      which instructions from the rest of the function can be "moved".
  292.      The definition should be a C expression whose value is an integer
  293.      representing the number of delay slots there.
  294. `ELIGIBLE_FOR_EPILOGUE_DELAY (INSN, N)'
  295.      A C expression that returns 1 if INSN can be placed in delay slot
  296.      number N of the epilogue.
  297.      The argument N is an integer which identifies the delay slot now
  298.      being considered (since different slots may have different rules of
  299.      eligibility).  It is never negative and is always less than the
  300.      number of epilogue delay slots (what `DELAY_SLOTS_FOR_EPILOGUE'
  301.      returns).  If you reject a particular insn for a given delay slot,
  302.      in principle, it may be reconsidered for a subsequent delay slot.
  303.      Also, other insns may (at least in principle) be considered for
  304.      the so far unfilled delay slot.
  305.      The insns accepted to fill the epilogue delay slots are put in an
  306.      RTL list made with `insn_list' objects, stored in the variable
  307.      `current_function_epilogue_delay_list'.  The insn for the first
  308.      delay slot comes first in the list.  Your definition of the macro
  309.      `FUNCTION_EPILOGUE' should fill the delay slots by outputting the
  310.      insns in this list, usually by calling `final_scan_insn'.
  311.      You need not define this macro if you did not define
  312.      `DELAY_SLOTS_FOR_EPILOGUE'.
  313. File: gcc.info,  Node: Profiling,  Prev: Function Entry,  Up: Stack and Calling
  314. Generating Code for Profiling
  315. -----------------------------
  316.    These macros will help you generate code for profiling.
  317. `FUNCTION_PROFILER (FILE, LABELNO)'
  318.      A C statement or compound statement to output to FILE some
  319.      assembler code to call the profiling subroutine `mcount'.  Before
  320.      calling, the assembler code must load the address of a counter
  321.      variable into a register where `mcount' expects to find the
  322.      address.  The name of this variable is `LP' followed by the number
  323.      LABELNO, so you would generate the name using `LP%d' in a
  324.      `fprintf'.
  325.      The details of how the address should be passed to `mcount' are
  326.      determined by your operating system environment, not by GNU CC.  To
  327.      figure them out, compile a small program for profiling using the
  328.      system's installed C compiler and look at the assembler code that
  329.      results.
  330. `PROFILE_BEFORE_PROLOGUE'
  331.      Define this macro if the code for function profiling should come
  332.      before the function prologue.  Normally, the profiling code comes
  333.      after.
  334. `FUNCTION_BLOCK_PROFILER (FILE, LABELNO)'
  335.      A C statement or compound statement to output to FILE some
  336.      assembler code to initialize basic-block profiling for the current
  337.      object module.  This code should call the subroutine
  338.      `__bb_init_func' once per object module, passing it as its sole
  339.      argument the address of a block allocated in the object module.
  340.      The name of the block is a local symbol made with this statement:
  341.           ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
  342.      Of course, since you are writing the definition of
  343.      `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  344.      can take a short cut in the definition of this macro and use the
  345.      name that you know will result.
  346.      The first word of this block is a flag which will be nonzero if the
  347.      object module has already been initialized.  So test this word
  348.      first, and do not call `__bb_init_func' if the flag is nonzero.
  349. `BLOCK_PROFILER (FILE, BLOCKNO)'
  350.      A C statement or compound statement to increment the count
  351.      associated with the basic block number BLOCKNO.  Basic blocks are
  352.      numbered separately from zero within each compilation.  The count
  353.      associated with block number BLOCKNO is at index BLOCKNO in a
  354.      vector of words; the name of this array is a local symbol made
  355.      with this statement:
  356.           ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
  357.      Of course, since you are writing the definition of
  358.      `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  359.      can take a short cut in the definition of this macro and use the
  360.      name that you know will result.
  361. `BLOCK_PROFILER_CODE'
  362.      A C function or functions which are needed in the library to
  363.      support block profiling.
  364. File: gcc.info,  Node: Varargs,  Next: Trampolines,  Prev: Stack and Calling,  Up: Target Macros
  365. Implementing the Varargs Macros
  366. ===============================
  367.    GNU CC comes with an implementation of `varargs.h' and `stdarg.h'
  368. that work without change on machines that pass arguments on the stack.
  369. Other machines require their own implementations of varargs, and the
  370. two machine independent header files must have conditionals to include
  371.    ANSI `stdarg.h' differs from traditional `varargs.h' mainly in the
  372. calling convention for `va_start'.  The traditional implementation
  373. takes just one argument, which is the variable in which to store the
  374. argument pointer.  The ANSI implementation of `va_start' takes an
  375. additional second argument.  The user is supposed to write the last
  376. named argument of the function here.
  377.    However, `va_start' should not use this argument.  The way to find
  378. the end of the named arguments is with the built-in functions described
  379. below.
  380. `__builtin_saveregs ()'
  381.      Use this built-in function to save the argument registers in
  382.      memory so that the varargs mechanism can access them.  Both ANSI
  383.      and traditional versions of `va_start' must use
  384.      `__builtin_saveregs', unless you use `SETUP_INCOMING_VARARGS' (see
  385.      below) instead.
  386.      On some machines, `__builtin_saveregs' is open-coded under the
  387.      control of the macro `EXPAND_BUILTIN_SAVEREGS'.  On other machines,
  388.      it calls a routine written in assembler language, found in
  389.      `libgcc2.c'.
  390.      Code generated for the call to `__builtin_saveregs' appears at the
  391.      beginning of the function, as opposed to where the call to
  392.      `__builtin_saveregs' is written, regardless of what the code is.
  393.      This is because the registers must be saved before the function
  394.      starts to use them for its own purposes.
  395. `__builtin_args_info (CATEGORY)'
  396.      Use this built-in function to find the first anonymous arguments in
  397.      registers.
  398.      In general, a machine may have several categories of registers
  399.      used for arguments, each for a particular category of data types.
  400.      (For example, on some machines, floating-point registers are used
  401.      for floating-point arguments while other arguments are passed in
  402.      the general registers.) To make non-varargs functions use the
  403.      proper calling convention, you have defined the `CUMULATIVE_ARGS'
  404.      data type to record how many registers in each category have been
  405.      used so far
  406.      `__builtin_args_info' accesses the same data structure of type
  407.      `CUMULATIVE_ARGS' after the ordinary argument layout is finished
  408.      with it, with CATEGORY specifying which word to access.  Thus, the
  409.      value indicates the first unused register in a given category.
  410.      Normally, you would use `__builtin_args_info' in the implementation
  411.      of `va_start', accessing each category just once and storing the
  412.      value in the `va_list' object.  This is because `va_list' will
  413.      have to update the values, and there is no way to alter the values
  414.      accessed by `__builtin_args_info'.
  415. `__builtin_next_arg ()'
  416.      This is the equivalent of `__builtin_args_info', for stack
  417.      arguments.  It returns the address of the first anonymous stack
  418.      argument, as type `void *'. If `ARGS_GROW_DOWNWARD', it returns
  419.      the address of the location above the first anonymous stack
  420.      argument. Use it in `va_start' to initialize the pointer for
  421.      fetching arguments from the stack.
  422. `__builtin_classify_type (OBJECT)'
  423.      Since each machine has its own conventions for which data types are
  424.      passed in which kind of register, your implementation of `va_arg'
  425.      has to embody these conventions.  The easiest way to categorize the
  426.      specified data type is to use `__builtin_classify_type' together
  427.      with `sizeof' and `__alignof__'.
  428.      `__builtin_classify_type' ignores the value of OBJECT, considering
  429.      only its data type.  It returns an integer describing what kind of
  430.      type that is--integer, floating, pointer, structure, and so on.
  431.      The file `typeclass.h' defines an enumeration that you can use to
  432.      interpret the values of `__builtin_classify_type'.
  433.    These machine description macros help implement varargs:
  434. `EXPAND_BUILTIN_SAVEREGS (ARGS)'
  435.      If defined, is a C expression that produces the machine-specific
  436.      code for a call to `__builtin_saveregs'.  This code will be moved
  437.      to the very beginning of the function, before any parameter access
  438.      are made.  The return value of this function should be an RTX that
  439.      contains the value to use as the return of `__builtin_saveregs'.
  440.      The argument ARGS is a `tree_list' containing the arguments that
  441.      were passed to `__builtin_saveregs'.
  442.      If this macro is not defined, the compiler will output an ordinary
  443.      call to the library function `__builtin_saveregs'.
  444. `SETUP_INCOMING_VARARGS (ARGS_SO_FAR, MODE, TYPE,'
  445.      PRETEND_ARGS_SIZE, SECOND_TIME) This macro offers an alternative
  446.      to using `__builtin_saveregs' and defining the macro
  447.      `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the anonymous register
  448.      arguments into the stack so that all the arguments appear to have
  449.      been passed consecutively on the stack.  Once this is done, you
  450.      can use the standard implementation of varargs that works for
  451.      machines that pass all their arguments on the stack.
  452.      The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
  453.      containing the values that obtain after processing of the named
  454.      arguments.  The arguments MODE and TYPE describe the last named
  455.      argument--its machine mode and its data type as a tree node.
  456.      The macro implementation should do two things: first, push onto the
  457.      stack all the argument registers *not* used for the named
  458.      arguments, and second, store the size of the data thus pushed into
  459.      the `int'-valued variable whose name is supplied as the argument
  460.      PRETEND_ARGS_SIZE.  The value that you store here will serve as
  461.      additional offset for setting up the stack frame.
  462.      Because you must generate code to push the anonymous arguments at
  463.      compile time without knowing their data types,
  464.      `SETUP_INCOMING_VARARGS' is only useful on machines that have just
  465.      a single category of argument register and use it uniformly for
  466.      all data types.
  467.      If the argument SECOND_TIME is nonzero, it means that the
  468.      arguments of the function are being analyzed for the second time.
  469.      This happens for an inline function, which is not actually
  470.      compiled until the end of the source file.  The macro
  471.      `SETUP_INCOMING_VARARGS' should not generate any instructions in
  472.      this case.
  473. File: gcc.info,  Node: Trampolines,  Next: Library Calls,  Prev: Varargs,  Up: Target Macros
  474. Trampolines for Nested Functions
  475. ================================
  476.    A "trampoline" is a small piece of code that is created at run time
  477. when the address of a nested function is taken.  It normally resides on
  478. the stack, in the stack frame of the containing function.  These macros
  479. tell GNU CC how to generate code to allocate and initialize a
  480. trampoline.
  481.    The instructions in the trampoline must do two things: load a
  482. constant address into the static chain register, and jump to the real
  483. address of the nested function.  On CISC machines such as the m68k,
  484. this requires two instructions, a move immediate and a jump.  Then the
  485. two addresses exist in the trampoline as word-long immediate operands.
  486. On RISC machines, it is often necessary to load each address into a
  487. register in two parts.  Then pieces of each address form separate
  488. immediate operands.
  489.    The code generated to initialize the trampoline must store the
  490. variable parts--the static chain value and the function address--into
  491. the immediate operands of the instructions.  On a CISC machine, this is
  492. simply a matter of copying each address to a memory reference at the
  493. proper offset from the start of the trampoline.  On a RISC machine, it
  494. may be necessary to take out pieces of the address and store them
  495. separately.
  496. `TRAMPOLINE_TEMPLATE (FILE)'
  497.      A C statement to output, on the stream FILE, assembler code for a
  498.      block of data that contains the constant parts of a trampoline.
  499.      This code should not include a label--the label is taken care of
  500.      automatically.
  501. `TRAMPOLINE_SECTION'
  502.      The name of a subroutine to switch to the section in which the
  503.      trampoline template is to be placed (*note Sections::.).  The
  504.      default is a value of `readonly_data_section', which places the
  505.      trampoline in the section containing read-only data.
  506. `TRAMPOLINE_SIZE'
  507.      A C expression for the size in bytes of the trampoline, as an
  508.      integer.
  509. `TRAMPOLINE_ALIGNMENT'
  510.      Alignment required for trampolines, in bits.
  511.      If you don't define this macro, the value of `BIGGEST_ALIGNMENT'
  512.      is used for aligning trampolines.
  513. `INITIALIZE_TRAMPOLINE (ADDR, FNADDR, STATIC_CHAIN)'
  514.      A C statement to initialize the variable parts of a trampoline.
  515.      aDDR is an RTX for the address of the trampoline; FNADDR is an RTX
  516.      for the address of the nested function; STATIC_CHAIN is an RTX for
  517.      the static chain value that should be passed to the function when
  518.      it is called.
  519. `ALLOCATE_TRAMPOLINE (FP)'
  520.      A C expression to allocate run-time space for a trampoline.  The
  521.      expression value should be an RTX representing a memory reference
  522.      to the space for the trampoline.
  523.      If this macro is not defined, by default the trampoline is
  524.      allocated as a stack slot.  This default is right for most
  525.      machines.  The exceptions are machines where it is impossible to
  526.      execute instructions in the stack area.  On such machines, you may
  527.      have to implement a separate stack, using this macro in
  528.      conjunction with `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE'.
  529.      FP points to a data structure, a `struct function', which
  530.      describes the compilation status of the immediate containing
  531.      function of the function which the trampoline is for.  Normally
  532.      (when `ALLOCATE_TRAMPOLINE' is not defined), the stack slot for the
  533.      trampoline is in the stack frame of this containing function.
  534.      Other allocation strategies probably must do something analogous
  535.      with this information.
  536.    Implementing trampolines is difficult on many machines because they
  537. have separate instruction and data caches.  Writing into a stack
  538. location fails to clear the memory in the instruction cache, so when
  539. the program jumps to that location, it executes the old contents.
  540.    Here are two possible solutions.  One is to clear the relevant parts
  541. of the instruction cache whenever a trampoline is set up.  The other is
  542. to make all trampolines identical, by having them jump to a standard
  543. subroutine.  The former technique makes trampoline execution faster; the
  544. latter makes initialization faster.
  545.    To clear the instruction cache when a trampoline is initialized,
  546. define the following macros which describe the shape of the cache.
  547. `INSN_CACHE_SIZE'
  548.      The total size in bytes of the cache.
  549. `INSN_CACHE_LINE_WIDTH'
  550.      The length in bytes of each cache line.  The cache is divided into
  551.      cache lines which are disjoint slots, each holding a contiguous
  552.      chunk of data fetched from memory.  Each time data is brought into
  553.      the cache, an entire line is read at once.  The data loaded into a
  554.      cache line is always aligned on a boundary equal to the line size.
  555. `INSN_CACHE_DEPTH'
  556.      The number of alternative cache lines that can hold any particular
  557.      memory location.
  558.    Alternatively, if the machine has system calls or instructions to
  559. clear the instruction cache directly, you can define the following
  560. macro.
  561.      If defined, expands to a C expression clearing the *instruction
  562.      cache* in the specified interval.  If it is not defined, and the
  563.      macro INSN_CACHE_SIZE is defined, some generic code is generated
  564.      to clear the cache.  The definition of this macro would typically
  565.      be a series of `asm' statements.  Both BEG and END are both pointer
  566.      expressions.
  567.    To use a standard subroutine, define the following macro.  In
  568. addition, you must make sure that the instructions in a trampoline fill
  569. an entire cache line with identical instructions, or else ensure that
  570. the beginning of the trampoline code is always aligned at the same
  571. point in its cache line.  Look in `m68k.h' as a guide.
  572. `TRANSFER_FROM_TRAMPOLINE'
  573.      Define this macro if trampolines need a special subroutine to do
  574.      their work.  The macro should expand to a series of `asm'
  575.      statements which will be compiled with GNU CC.  They go in a
  576.      library function named `__transfer_from_trampoline'.
  577.      If you need to avoid executing the ordinary prologue code of a
  578.      compiled C function when you jump to the subroutine, you can do so
  579.      by placing a special label of your own in the assembler code.  Use
  580.      one `asm' statement to generate an assembler label, and another to
  581.      make the label global.  Then trampolines can use that label to
  582.      jump directly to your special assembler code.
  583. File: gcc.info,  Node: Library Calls,  Next: Addressing Modes,  Prev: Trampolines,  Up: Target Macros
  584. Implicit Calls to Library Routines
  585. ==================================
  586. `MULSI3_LIBCALL'
  587.      A C string constant giving the name of the function to call for
  588.      multiplication of one signed full-word by another.  If you do not
  589.      define this macro, the default name is used, which is `__mulsi3',
  590.      a function defined in `libgcc.a'.
  591. `DIVSI3_LIBCALL'
  592.      A C string constant giving the name of the function to call for
  593.      division of one signed full-word by another.  If you do not define
  594.      this macro, the default name is used, which is `__divsi3', a
  595.      function defined in `libgcc.a'.
  596. `UDIVSI3_LIBCALL'
  597.      A C string constant giving the name of the function to call for
  598.      division of one unsigned full-word by another.  If you do not
  599.      define this macro, the default name is used, which is `__udivsi3',
  600.      a function defined in `libgcc.a'.
  601. `MODSI3_LIBCALL'
  602.      A C string constant giving the name of the function to call for the
  603.      remainder in division of one signed full-word by another.  If you
  604.      do not define this macro, the default name is used, which is
  605.      `__modsi3', a function defined in `libgcc.a'.
  606. `UMODSI3_LIBCALL'
  607.      A C string constant giving the name of the function to call for the
  608.      remainder in division of one unsigned full-word by another.  If
  609.      you do not define this macro, the default name is used, which is
  610.      `__umodsi3', a function defined in `libgcc.a'.
  611. `MULDI3_LIBCALL'
  612.      A C string constant giving the name of the function to call for
  613.      multiplication of one signed double-word by another.  If you do not
  614.      define this macro, the default name is used, which is `__muldi3',
  615.      a function defined in `libgcc.a'.
  616. `DIVDI3_LIBCALL'
  617.      A C string constant giving the name of the function to call for
  618.      division of one signed double-word by another.  If you do not
  619.      define this macro, the default name is used, which is `__divdi3', a
  620.      function defined in `libgcc.a'.
  621. `UDIVDI3_LIBCALL'
  622.      A C string constant giving the name of the function to call for
  623.      division of one unsigned full-word by another.  If you do not
  624.      define this macro, the default name is used, which is `__udivdi3',
  625.      a function defined in `libgcc.a'.
  626. `MODDI3_LIBCALL'
  627.      A C string constant giving the name of the function to call for the
  628.      remainder in division of one signed double-word by another.  If
  629.      you do not define this macro, the default name is used, which is
  630.      `__moddi3', a function defined in `libgcc.a'.
  631. `UMODDI3_LIBCALL'
  632.      A C string constant giving the name of the function to call for the
  633.      remainder in division of one unsigned full-word by another.  If
  634.      you do not define this macro, the default name is used, which is
  635.      `__umoddi3', a function defined in `libgcc.a'.
  636. `TARGET_EDOM'
  637.      The value of `EDOM' on the target machine, as a C integer constant
  638.      expression.  If you don't define this macro, GNU CC does not
  639.      attempt to deposit the value of `EDOM' into `errno' directly.
  640.      Look in `/usr/include/errno.h' to find the value of `EDOM' on your
  641.      system.
  642.      If you do not define `TARGET_EDOM', then compiled code reports
  643.      domain errors by calling the library function and letting it
  644.      report the error.  If mathematical functions on your system use
  645.      `matherr' when there is an error, then you should leave
  646.      `TARGET_EDOM' undefined so that `matherr' is used normally.
  647. `GEN_ERRNO_RTX'
  648.      Define this macro as a C expression to create an rtl expression
  649.      that refers to the global "variable" `errno'.  (On certain systems,
  650.      `errno' may not actually be a variable.)  If you don't define this
  651.      macro, a reasonable default is used.
  652. `TARGET_MEM_FUNCTIONS'
  653.      Define this macro if GNU CC should generate calls to the System V
  654.      (and ANSI C) library functions `memcpy' and `memset' rather than
  655.      the BSD functions `bcopy' and `bzero'.
  656. `LIBGCC_NEEDS_DOUBLE'
  657.      Define this macro if only `float' arguments cannot be passed to
  658.      library routines (so they must be converted to `double').  This
  659.      macro affects both how library calls are generated and how the
  660.      library routines in `libgcc1.c' accept their arguments.  It is
  661.      useful on machines where floating and fixed point arguments are
  662.      passed differently, such as the i860.
  663. `FLOAT_ARG_TYPE'
  664.      Define this macro to override the type used by the library
  665.      routines to pick up arguments of type `float'.  (By default, they
  666.      use a union of `float' and `int'.)
  667.      The obvious choice would be `float'--but that won't work with
  668.      traditional C compilers that expect all arguments declared as
  669.      `float' to arrive as `double'.  To avoid this conversion, the
  670.      library routines ask for the value as some other type and then
  671.      treat it as a `float'.
  672.      On some systems, no other type will work for this.  For these
  673.      systems, you must use `LIBGCC_NEEDS_DOUBLE' instead, to force
  674.      conversion of the values `double' before they are passed.
  675. `FLOATIFY (PASSED-VALUE)'
  676.      Define this macro to override the way library routines redesignate
  677.      a `float' argument as a `float' instead of the type it was passed
  678.      as.  The default is an expression which takes the `float' field of
  679.      the union.
  680. `FLOAT_VALUE_TYPE'
  681.      Define this macro to override the type used by the library
  682.      routines to return values that ought to have type `float'.  (By
  683.      default, they use `int'.)
  684.      The obvious choice would be `float'--but that won't work with
  685.      traditional C compilers gratuitously convert values declared as
  686.      `float' into `double'.
  687. `INTIFY (FLOAT-VALUE)'
  688.      Define this macro to override the way the value of a
  689.      `float'-returning library routine should be packaged in order to
  690.      return it.  These functions are actually declared to return type
  691.      `FLOAT_VALUE_TYPE' (normally `int').
  692.      These values can't be returned as type `float' because traditional
  693.      C compilers would gratuitously convert the value to a `double'.
  694.      A local variable named `intify' is always available when the macro
  695.      `INTIFY' is used.  It is a union of a `float' field named `f' and
  696.      a field named `i' whose type is `FLOAT_VALUE_TYPE' or `int'.
  697.      If you don't define this macro, the default definition works by
  698.      copying the value through that union.
  699. `nongcc_SI_type'
  700.      Define this macro as the name of the data type corresponding to
  701.      `SImode' in the system's own C compiler.
  702.      You need not define this macro if that type is `long int', as it
  703.      usually is.
  704. `nongcc_word_type'
  705.      Define this macro as the name of the data type corresponding to the
  706.      word_mode in the system's own C compiler.
  707.      You need not define this macro if that type is `long int', as it
  708.      usually is.
  709. `perform_...'
  710.      Define these macros to supply explicit C statements to carry out
  711.      various arithmetic operations on types `float' and `double' in the
  712.      library routines in `libgcc1.c'.  See that file for a full list of
  713.      these macros and their arguments.
  714.      On most machines, you don't need to define any of these macros,
  715.      because the C compiler that comes with the system takes care of
  716.      doing them.
  717. `NEXT_OBJC_RUNTIME'
  718.      Define this macro to generate code for Objective C message sending
  719.      using the calling convention of the NeXT system.  This calling
  720.      convention involves passing the object, the selector and the
  721.      method arguments all at once to the method-lookup library function.
  722.      The default calling convention passes just the object and the
  723.      selector to the lookup function, which returns a pointer to the
  724.      method.
  725. File: gcc.info,  Node: Addressing Modes,  Next: Condition Code,  Prev: Library Calls,  Up: Target Macros
  726. Addressing Modes
  727. ================
  728. `HAVE_POST_INCREMENT'
  729.      Define this macro if the machine supports post-increment
  730.      addressing.
  731. `HAVE_PRE_INCREMENT'
  732. `HAVE_POST_DECREMENT'
  733. `HAVE_PRE_DECREMENT'
  734.      Similar for other kinds of addressing.
  735. `CONSTANT_ADDRESS_P (X)'
  736.      A C expression that is 1 if the RTX X is a constant which is a
  737.      valid address.  On most machines, this can be defined as
  738.      `CONSTANT_P (X)', but a few machines are more restrictive in which
  739.      constant addresses are supported.
  740.      `CONSTANT_P' accepts integer-values expressions whose values are
  741.      not explicitly known, such as `symbol_ref', `label_ref', and
  742.      `high' expressions and `const' arithmetic expressions, in addition
  743.      to `const_int' and `const_double' expressions.
  744. `MAX_REGS_PER_ADDRESS'
  745.      A number, the maximum number of registers that can appear in a
  746.      valid memory address.  Note that it is up to you to specify a
  747.      value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
  748.      would ever accept.
  749. `GO_IF_LEGITIMATE_ADDRESS (MODE, X, LABEL)'
  750.      A C compound statement with a conditional `goto LABEL;' executed
  751.      if X (an RTX) is a legitimate memory address on the target machine
  752.      for a memory operand of mode MODE.
  753.      It usually pays to define several simpler macros to serve as
  754.      subroutines for this one.  Otherwise it may be too complicated to
  755.      understand.
  756.      This macro must exist in two variants: a strict variant and a
  757.      non-strict one.  The strict variant is used in the reload pass.  It
  758.      must be defined so that any pseudo-register that has not been
  759.      allocated a hard register is considered a memory reference.  In
  760.      contexts where some kind of register is required, a pseudo-register
  761.      with no hard register must be rejected.
  762.      The non-strict variant is used in other passes.  It must be
  763.      defined to accept all pseudo-registers in every context where some
  764.      kind of register is required.
  765.      Compiler source files that want to use the strict variant of this
  766.      macro define the macro `REG_OK_STRICT'.  You should use an `#ifdef
  767.      REG_OK_STRICT' conditional to define the strict variant in that
  768.      case and the non-strict variant otherwise.
  769.      Subroutines to check for acceptable registers for various purposes
  770.      (one for base registers, one for index registers, and so on) are
  771.      typically among the subroutines used to define
  772.      `GO_IF_LEGITIMATE_ADDRESS'.  Then only these subroutine macros
  773.      need have two variants; the higher levels of macros may be the
  774.      same whether strict or not.
  775.      Normally, constant addresses which are the sum of a `symbol_ref'
  776.      and an integer are stored inside a `const' RTX to mark them as
  777.      constant.  Therefore, there is no need to recognize such sums
  778.      specifically as legitimate addresses.  Normally you would simply
  779.      recognize any `const' as legitimate.
  780.      Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant
  781.      sums that are not marked with  `const'.  It assumes that a naked
  782.      `plus' indicates indexing.  If so, then you *must* reject such
  783.      naked constant sums as illegitimate addresses, so that none of
  784.      them will be given to `PRINT_OPERAND_ADDRESS'.
  785.      On some machines, whether a symbolic address is legitimate depends
  786.      on the section that the address refers to.  On these machines,
  787.      define the macro `ENCODE_SECTION_INFO' to store the information
  788.      into the `symbol_ref', and then check for it here.  When you see a
  789.      `const', you will have to look inside it to find the `symbol_ref'
  790.      in order to determine the section.  *Note Assembler Format::.
  791.      The best way to modify the name string is by adding text to the
  792.      beginning, with suitable punctuation to prevent any ambiguity.
  793.      Allocate the new name in `saveable_obstack'.  You will have to
  794.      modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
  795.      and output the name accordingly, and define `STRIP_NAME_ENCODING'
  796.      to access the original name string.
  797.      You can check the information stored here into the `symbol_ref' in
  798.      the definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and
  799.      `PRINT_OPERAND_ADDRESS'.
  800. `REG_OK_FOR_BASE_P (X)'
  801.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  802.      valid for use as a base register.  For hard registers, it should
  803.      always accept those which the hardware permits and reject the
  804.      others.  Whether the macro accepts or rejects pseudo registers
  805.      must be controlled by `REG_OK_STRICT' as described above.  This
  806.      usually requires two variant definitions, of which `REG_OK_STRICT'
  807.      controls the one actually used.
  808. `REG_OK_FOR_INDEX_P (X)'
  809.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  810.      valid for use as an index register.
  811.      The difference between an index register and a base register is
  812.      that the index register may be scaled.  If an address involves the
  813.      sum of two registers, neither one of them scaled, then either one
  814.      may be labeled the "base" and the other the "index"; but whichever
  815.      labeling is used must fit the machine's constraints of which
  816.      registers may serve in each capacity.  The compiler will try both
  817.      labelings, looking for one that is valid, and will reload one or
  818.      both registers only if neither labeling works.
  819. `LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN)'
  820.      A C compound statement that attempts to replace X with a valid
  821.      memory address for an operand of mode MODE.  WIN will be a C
  822.      statement label elsewhere in the code; the macro definition may use
  823.           GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
  824.      to avoid further processing if the address has become legitimate.
  825.      X will always be the result of a call to `break_out_memory_refs',
  826.      and OLDX will be the operand that was given to that function to
  827.      produce X.
  828.      The code generated by this macro should not alter the substructure
  829.      of X.  If it transforms X into a more legitimate form, it should
  830.      assign X (which will always be a C variable) a new value.
  831.      It is not necessary for this macro to come up with a legitimate
  832.      address.  The compiler has standard ways of doing so in all cases.
  833.      In fact, it is safe for this macro to do nothing.  But often a
  834.      machine-dependent strategy can generate better code.
  835. `GO_IF_MODE_DEPENDENT_ADDRESS (ADDR, LABEL)'
  836.      A C statement or compound statement with a conditional `goto
  837.      LABEL;' executed if memory address X (an RTX) can have different
  838.      meanings depending on the machine mode of the memory reference it
  839.      is used for or if the address is valid for some modes but not
  840.      others.
  841.      Autoincrement and autodecrement addresses typically have
  842.      mode-dependent effects because the amount of the increment or
  843.      decrement is the size of the operand being addressed.  Some
  844.      machines have other mode-dependent addresses.  Many RISC machines
  845.      have no mode-dependent addresses.
  846.      You may assume that ADDR is a valid address for the machine.
  847. `LEGITIMATE_CONSTANT_P (X)'
  848.      A C expression that is nonzero if X is a legitimate constant for
  849.      an immediate operand on the target machine.  You can assume that X
  850.      satisfies `CONSTANT_P', so you need not check this.  In fact, `1'
  851.      is a suitable definition for this macro on machines where anything
  852.      `CONSTANT_P' is valid.
  853.